﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using T_Person.Domain;

namespace T_Person.BaseRep
{
    public interface IBaseRepInterface<T> where T : class
    {
        /// <summary>
        /// 异步添加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<int> Add(T model);
        /// <summary>
        /// 异步修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<int> Update(T model);
        /// <summary>
        /// 异步范围修改
        /// </summary>
        /// <param name="values"></param>
        /// <returns></returns>
        Task<int> UpdateRange(List<T> values);
        /// <summary>
        /// 异步删除方法
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<int> Delete(T model);
        /// <summary>
        /// 异步多数据删除方法
        /// </summary>
        /// <param name="ints"></param>
        /// <returns></returns>
        Task<int> DeleteRange(List<T> values);
        /// <summary>
        /// 通过主键查询到单条数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<T> GetAloneByid(int id);
        /// <summary>
        /// 通过条件查询单条数据
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        Task<T> GetAloneByresult(Expression<Func<T, bool>> result);
        /// <summary>
        /// 获取所有数据
        /// </summary>
        /// <returns></returns>
        Task<IQueryable<T>> Getvalues();
        /// <summary>
        /// 有条件获取所有数据
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        Task<IQueryable<T>> GetvaluesByResult(Expression<Func<T, bool>> result);
       
    }
}
